// index.ts
// 获取应用实例
const app = getApp();
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    selected: {
      type: Number,
      value: 0,
    },
  },
  /**
   * 组件的初始数据
   */
  data: {
    selected: 0,
    // color: "#515151",
    // selectedColor: "#482936",
    colors: app.globalData.colors.themejscolor,
    list: [{
      pagePath: "/pages/home/index",
      iconPath: "/statics/images/tabbar/home.png",
      selectedIconPath: "/statics/images/tabbar/home_.png",
      text: "首页"
    },{
      pagePath: "/pages/square/index",
      iconPath: "/statics/images/tabbar/square.png",
      selectedIconPath: "/statics/images/tabbar/square_.png",
      text: "广场"
    },{
      pagePath: "/pages/live/index",
      iconPath: "/statics/images/tabbar/video.png",
      selectedIconPath: "/statics/images/tabbar/video_.png",
      text: ""
    },{
      pagePath: "/pages/news/index",
      iconPath: "/statics/images/tabbar/news.png",
      selectedIconPath: "/statics/images/tabbar/news_.png",
      text: "消息"
    },{
      pagePath: "/pages/mine/index",
      iconPath: "/statics/images/tabbar/mine.png",
      selectedIconPath: "/statics/images/tabbar/mine_.png",
      text: "我的"
    }]
  },
  /**
   * 组件的方法列表
   */
  methods: {
    switchTab(e:any) {
      const data = e.currentTarget.dataset;
      const url = data.path;
      wx.switchTab({url});
      // this.setData({
      //   selected: data.index
      // })
    },
  },
  pageLifetimes: {
    show() {
      // if (typeof this.getTabBar === 'function' &&
      //   this.getTabBar()) {
      //   this.getTabBar().setData({
      //     selected: 0
      //   })
      // }
    }
  }
})